<?php

class Exts_View_Helper_FlashMessenger extends Zend_View_Helper_FormElement {

	private $_types = array(
		Exts_Controller_Action_Helper_ZsamerFlashMessenger::ERROR,
		Exts_Controller_Action_Helper_ZsamerFlashMessenger::WARNING,
		Exts_Controller_Action_Helper_ZsamerFlashMessenger::NOTICE,
		Exts_Controller_Action_Helper_ZsamerFlashMessenger::SUCCESS
	);

	public function flashMessenger() {
		$flashMessenger = Zend_Controller_Action_HelperBroker::getStaticHelper(
				'Exts_Controller_Action_Helper_Message'
		);
		var_dump($this->_types);
		exit;
		$html = '';
		foreach ($this->_types as $type) {
			$messages = $flashMessenger->getMessages($type);
			if (!$messages) {
				$messages = $flashMessenger->getCurrentMessages($type);
			}
			if ($messages) {
				if (!$html) {
					$html .= '<ul class="messages">';
				}
				$html .= '<li class="' . $type . '-msg">';
				$html .= '<ul>';
				foreach ($messages as $message) {
					$html.= '<li>';
					$html.= $message->message;
					$html.= '</li>';
				}
				$html .= '</ul>';
				$html .= '</li>';
			}
		}
		if ($html) {
			$html .= '</ul>';
		}
		return $html;
	}

}
